<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<title>预约邮件参数配置</title>
<link href="./public/core/admin/css/base.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="./public/core/index/js/dedeajax2.js"></script>
<script  type="text/javascript" src="./public/core/admin/js/yuyue_mail.js"></script>
	
</head>
<body background='img/allbg.gif' leftmargin='8' topmargin='8'>
<div class="bodytitle">
	<div class="bodytitleleft"></div>
	<div class="bodytitletxt">
		<a href='../yuyue' target='_blank'><b>在线预约模块</b></a> --
		<input type='button' name='edit' value="邮件参数配置" class="np coolbg" onClick="window.location.href='?action=edit'"/>
		<input type='button' name='template' value="邮件模板配置" class="np coolbg" onClick="window.location.href='?action=template'"/> 	
	</div>
<?php
	if(empty($action)||$action=='edit')
	{
?>
  <form name="form" action="?do=yuyue_email" method="post">
  		<input type="hidden" name="action" value="edit" />
		<input type="hidden" name="step" value="2" />
		<table width="100%" border="0" cellpadding="1" cellspacing="1" align="center" class="tbtitle"   background:#E2F5BC;>
			<tr>
				<td colspan="2" bgcolor="#EDF9D5" background="img/wbg.gif">
				<strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;如果您的服务器支持 Mail 函数（具体信息请咨询您的空间提供商）。</strong><br>
				<strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;我们建议您使用系统的Mail 函数。当您的服务器不支持 Mail 函数的时候您也可以选用 SMTP 作为邮件服务器</strong>
			</tr>
			<tr align="center" height="20" bgcolor="#FDFDF2">
				<td align="right" bgcolor="#FFFFFF" width="20%">邮件服务：</td>
				<td bgcolor="#FFFFFF" align="left">
					<input type='radio' class='np' name='issmtp' value='0' <?php if($emailset['issmtp']=='0') echo "checked"; ?>/>采用服务器内置的 Mail 服务
					<input type='radio' class='np' name='issmtp' value='1' <?php if($emailset['issmtp']==='1') echo "checked"; ?>/>采用其他的 SMTP 服务 
 					<span>&nbsp;&nbsp;&nbsp;&nbsp;(如果你选择内置的Mail服务,将不需要填写以下内容)</span>
				</td>
			</tr>
			<tr align="center" height="20" bgcolor="#ECFACD">
				<td align="right" bgcolor="#FFFFFF">smtp服务器：</td>
				<td align="left">
					<input type='text' name='smtp_host' id='smtp_host' value="<?php echo $emailset['smtp_host']; ?>" style='width:45%'/>
				</td>
			</tr>
			<tr align="center" height="20" bgcolor="#FDFDF2">
				<td align="right" bgcolor="#FFFFFF">smtp服务器端口：</td>
				<td align="left">
					<input type='text' name='smtp_port' id='smtp_port' value="<?php echo $emailset['smtp_port']; ?>" style='width:45%'/>
				</td>
			</tr>
			<tr align="center" height="20" bgcolor="#ECFACD">
				<td align="right" bgcolor="#FFFFFF">SMTP服务器的用户邮箱：</td>
				<td align="left">
					<input type='text' name='smtp_email' id='smtp_email' value="<?php echo $emailset['smtp_email']; ?>" style='width:45%'/>
				</td>
			</tr>
			<tr align="center" height="20" bgcolor="#ECFACD">
				<td align="right" bgcolor="#FFFFFF">SMTP服务器的用户密码：</td>
				<td align="left">
					<input type='password' name='smtp_pw' id='smtp_pw' value="<?php echo $emailset['smtp_pw']; ?>" style='width:45%'/>
				</td>
			</tr>
			<tr align="center" height="20" bgcolor="#FDFDF2">
				<td align="right" bgcolor="#FFFFFF">客服email：</td>
				<td align="left">
					<input type='text' name='kefu_email' id='kefu_email' value="<?php echo $emailset['kefu_email']; ?>" style='width:45%'/>
					<span>&nbsp;&nbsp;&nbsp;(用于接收预约的邮箱，请先测试)</span>
				</td>
			</tr>	
			<tr align="center" height="20" bgcolor="#ECFACD">
				<td align="right" bgcolor="#FFFFFF">测试邮箱：</td>
				<td align="left">
					<input type='text' name='test_email' id='test_email' value="" style='width:30%'/>
					<input type='button' name='test' value="发送测设邮件" class="np coolbg" onClick="javascript:sendTestEmail();"/>
					<span name='allow' id='allow'> </span>
				</td>
			</tr>	
			<tr>
				<td height="35" bgcolor="#FFFFFF">&nbsp;</td>
				<td bgcolor="#F8FCF1">
					<input name="submit" type="submit" value="保存" class="np coolbg"/>
					<input name="reset"  type="reset"  value="重置" class="np coolbg"/>
				</td>
   			 </tr>
		</table>
</form>
<?php
	}else if($action=='template')
	{

?>
	<form name="form" action="?do=yuyue_email" method="post">
		<input type="hidden" name="action" value="template" />
		<input type="hidden" name="step" value="2" />
		<input type="hidden" name="id" value="<?php echo $id;?>" />
		<table width="100%" border="0" cellpadding="1" cellspacing="1" align="center" class="tbtitle"   background:#E2F5BC;>
		  <tr>
			<td style="font-weight: bold; " width="15%">请选择邮件模版：</td>
			<td>
				<select id="selTemplate" onChange="javascript:loadTemplate(this.value);" >
					<?php
						foreach($templates as $key=>$value)
						{	
							$selected="";
							if($id==$key) $selected="selected=\"selected\"";
							echo "<option value='$key' $selected>".$value['subject']."</option>";
						}					
					?>
				</select>
			</td>
		  </tr>
		  <tr>
			<td style="font-weight: bold" >邮件类型:</td>
			<td>
			  <input type="radio" name="is_html" value="0"  <?php if($templates[$id]['is_html']=='0') echo "checked";?> />纯文本邮件    
			  <input type="radio" name="is_html" value="1"  <?php if($templates[$id]['is_html']=='1') echo "checked";?> />HTML 邮件
			</td>
		  </tr>
		  <tr>
			<td colspan="2" align="left">
				<textarea id="content" name="content" style="width:90%; text-align:left; text-indent:0px" rows="16" >
					<?php echo $templates[$id]['content'];?>
				</textarea>
			</td>
		  </tr>
		  <tr>
			<td colspan="2" align="center"><input type="submit" value=" 确定 "  class="np coolbg"/></td>
		  </tr>
		</table>
	</form>
<?php
	}
?>
</div>
</body>
</html>